// @Author EthanScriptOn
// @Desc
package resource

// IResourceManager Explorer
type IResourceManager interface {
	// OperateResource manipulate resources
	OperateResource(resourceOptions *ResourceOptions) (err error)
	// ComputeIfAbsent If it does not exist, take action
	ComputeIfAbsent(identifier interface{}, option func(interface{}) interface{}) (interface{}, error, bool)
	// ComputeIfPresent If it exists, it will be operated
	ComputeIfPresent(identifier interface{}, option func(interface{}) interface{}) (interface{}, error, bool)
	// GetResource Get a resource
	GetResource(identifier interface{}) (interface{}, error, bool)
	// DelResource Delete a resource
	DelResource(identifier interface{}) (interface{}, error, bool)
	// AddResource Add a resource
	AddResource(identifier interface{}, val interface{}) (interface{}, error, bool)
}

// ResourceManagerUpGradation Multi-level explorer
type ResourceManagerUpGradation interface {
	// AddResource Add resources
	AddResource(resourceEntity ResourceEntity, resourceLevels []ResourceLevel, cover bool) error
	// DelResourceWithId Delete a resource based on its ID
	DelResourceWithId(identifier interface{}) (err error)
	// DelResourceWithLevels Delete resources based on level
	DelResourceWithLevels(resourceLevels []ResourceLevel) (err error)
	// FoundResourceWithId Find resources based on ID
	FoundResourceWithId(identifier interface{}) (ResourceEntity, error)
	// FoundResourceWithLevels Find resources based on level
	FoundResourceWithLevels(resourceLevels []ResourceLevel) (result []ResourceEntity, err error)
	// FoundResourceWithCustomer Customize resource finding
	FoundResourceWithCustomer(optionFun func(ResourceEntity) bool) (result []ResourceEntity, err error)
	// Sort sort
	Sort() func(pre ResourceEntity, suf ResourceEntity) bool
}
